home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / asmutil / disasm.zip / UASM-INT.BAS < prev    next >
BASIC Source File  |  1988-06-03  |  10KB  |  182 lines

  1. 10 '--------------------------------------------------------------------------
  2. 11 '|    UASM-INT  1.06        23 Oct., 1983        White Crane Systems  |
  3. 12 '|    copyright 1983        Guy C. Gordon        3194 Friar Tuck Way  |
  4. 13 '|                              Doraville, GA 30340  |
  5. 14 '|                                         |
  6. 16 '|    This program takes the Unassemble output from UASM-JMP and puts in   |
  7. 22 '|    Macros for the DOS interrupts.  The Macro calls and Symbols are      |
  8. 24 '|    contained in the companion file UASM-DOS.MAC, which contains a         |
  9. 26 '|    table of Equates which may be included in the final .ASM listing.    |
  10. 27 '|     If you modify the table to suit your needs or taste, make certain    |
  11. 30 '|    that it meets the requirements of both this program and your         |
  12. 32 '|    assembler.                                 |
  13. 40 '|                                         |
  14. 42 '|    For best speed, and to save wear on your floppy disk drives,         |
  15. 44 '|    specify the input and output files on separate drives.             |
  16. 50 '********************************* NOTICE *********************************
  17. 51 '*          USER SUPPORTED SOFTWARE (With thanks to Andrew Flugelman)     *
  18. 52 '*                                                                        *
  19. 53 '*   A limited license is granted to all users of this program, to make   *
  20. 54 '*   copies of this program and distribute them to other users subject    *
  21. 55 '*   to the following conditions:                                         *
  22. 56 '*           1.  None of the notices or credits are to be bypassed,       *
  23. 57 '*               altered, or removed.                                     *
  24. 58 '*           2.  The program is not to be distributed in modified form.   *
  25. 59 '*               (Users are encouraged to distribute MERGE files.)        *
  26. 60 '*           3.  No fee is to be charged (or any other consideration      *
  27. 61 '*               received) for copying or distributing the program        *
  28. 62 '*               without an express written agreement with                *
  29. 63 '*               White Crane Systems.                                     *
  30. 64 '**************************************************************************
  31. 70 CLS 'PRINT CHR$(27)+"E";   'CLS
  32. 71 PRINT "                                UASM-INT
  33. 72 PRINT "          White Crane Systems Unassembler - Interrupt Module
  34. 73 PRINT "
  35. 74 PRINT "           If you are using this program and finding it of value
  36. 75 PRINT "      please send  a cash contribution to support its upkeep and
  37. 76 PRINT "      distribution.   Use the UASM system  of programs to  unas-
  38. 77 PRINT "      semble one average length .COM file, look over the results
  39. 78 PRINT "      and calculate how many hours this would have taken you  to
  40. 79 PRINT "      to produce,  multiply by the minimum wage, contribute that
  41. 80 PRINT "      amount and use the programs free thereafter. If that's too
  42. 81 PRINT "      much just send $20.   Supporters will receive  free notice 
  43. 82 PRINT "      of enhancements and updates.
  44. 83 PRINT "           In any case you are encouraged to copy and distribute 
  45. 84 PRINT "      UASM to your friends provided you do so free of charge and
  46. 85 PRINT "      in unmodified form.
  47. 87 PRINT " 
  48. 88 PRINT "                          Guy C. Gordon
  49. 89 PRINT "                          White Crane Systems
  50. 90 PRINT "                          3194 Friar Tuck Way
  51. 91 PRINT "                          Doraville, GA 30340
  52. 92 PRINT " 
  53. 100    DEFINT A-Z
  54. 110    TRUE=(1=1): FALSE=NOT TRUE
  55. 115    PRINT
  56. 120    INPUT "Enter name of  input file: ", INFILE$
  57. 130      DR=INSTR(INFILE$,":"): EXT=INSTR(INFILE$,".")
  58. 140      IF EXT=0 THEN INFILE$=INFILE$+".JMP": EXT=INSTR(INFILE$,".")
  59. 150    INPUT "Enter name of output file: ", OUTFILE$
  60. 160      IF INSTR(OUTFILE$,":")=LEN(OUTFILE$) THEN OUTFILE$=OUTFILE$+MID$(INFILE$,DR+1,EXT-DR-1)
  61. 170      IF INSTR(OUTFILE$,".")=0 THEN OUTFILE$=OUTFILE$+".INT"
  62. 180    PRINT
  63. 190    GOSUB 1000            'Read UASM-DOS.MAC file
  64. 200 '------------------------------------------------------------------------
  65. 201 '|                READ SOURCE FILE                |
  66. 202 '------------------------------------------------------------------------
  67. 205    PRINT TIME$,"Reading "INFILE$: PRINT ,"Writing "OUTFILE$: PRINT
  68. 210    OPEN  INFILE$ FOR  INPUT AS #1
  69. 220    OPEN OUTFILE$ FOR OUTPUT AS #2
  70. 225    PRINT #2,"INCLUDE    UASM-DOS.MAC"
  71. 230    WHILE NOT EOF(1)
  72. 235      '            Keep track of registers
  73. 240      LINE INPUT #1,A$
  74. 250      IF LEFT$(A$,1)="L" THEN AX$="": AH$="": AL$="": D$=""     'Entry point
  75. 260      IF  MID$(A$,17,1)<>"A" THEN 300    'Found defnition of A
  76. 270        IF MID$(A$,18,1)="X" THEN AX$=MID$(A$,20): AH$="": AL$="": GOTO 310
  77. 280        IF MID$(A$,18,1)="H" THEN AH$=MID$(A$,20): GOTO 310
  78. 290        IF MID$(A$,18,1)="L" THEN AL$=MID$(A$,20): GOTO 310
  79. 300      IF MID$(A$,17,2)="DX" OR MID$(A$,17,2)="DL"  THEN D$=MID$(A$,20)
  80. 310      '            Take care of INTerrupts
  81. 320      IF MID$(A$,9,3)="INT" THEN GOSUB 2000 ELSE PRINT #2, A$
  82. 380    WEND
  83. 385    PRINT: PRINT TIME$,"UASM-INT Complete."    'how can I get any work done
  84. 390    CLOSE: END                'when you keep interrupting me?
  85. 1000 '-------------------------------------------------------------------------
  86. 1001 '|            READ INTERRUPT 21 SERVICE CODES                  |
  87. 1002 '-------------------------------------------------------------------------
  88. 1005    PRINT TIME$,"Reading UASM-DOS.MAC"
  89. 1010    ON ERROR GOTO 1110
  90. 1020    OPEN "UASM-DOS.MAC" FOR INPUT AS #1
  91. 1030    LINE INPUT #1,A$: MAXSERV=VAL("&H"+MID$(A$,2,2))
  92. 1040    DIM SERVICE$(MAXSERV+1),COMMENT$(MAXSERV+1)
  93. 1050    ON ERROR GOTO 0
  94. 1060    WHILE NOT EOF(1):
  95. 1070      LINE INPUT #1,A$
  96. 1080      IF LEFT$(A$,4)=";END" THEN 1120
  97. 1090      IF LEFT$(A$,1)<>";" THEN SERV=VAL("&H"+MID$(A$,19,2)): SERVICE$(SERV)=LEFT$(A$,12): COMMENT$(SERV)=MID$(A$,21)
  98. 1100    WEND
  99. 1110    ON ERROR GOTO 0
  100. 1120    CLOSE: RETURN
  101. 2000 '-------------------------------------------------------------------------
  102. 2001 '|                INTERRUPT                      |
  103. 2002 '-------------------------------------------------------------------------
  104. 2010    INTERRUPT=VAL("&H"+MID$(A$,17,2))
  105. 2020    IF INTERRUPT=&H21 THEN 2100
  106. 2025    C$=CHR$(9)+";"    'tab
  107. 2030    IF INTERRUPT<=0 THEN 5000
  108. 2040    ON INTERRUPT GOTO 5100,5200,5300,5400,5500,5600,5700,5800,5900,6000,6100,6200,6300,6400,6500,7000,7100,7200,7300,7400,7500,7600,7700,7800,7900,8000,8100,8200,8300,8400,8500,9000,9100,9200,9300,9400,9500,9600,9700
  109. 2050    GOTO 10000
  110. 2099 '-------------------------------------------------------------------------
  111. 2100 '|              Determine value of AH (service code)          |
  112. 2101 '-------------------------------------------------------------------------
  113. 2105    IF INSTR(AH$," ")>0 THEN AH$=LEFT$(AH$,INSTR(AH$," ")-1)
  114. 2110    IF LEN(AH$)=2 THEN AH=VAL("&H"+AH$): GOTO 2200
  115. 2115    IF INSTR(AX$," ")>0 THEN AX$=LEFT$(AX$,INSTR(AX$," ")-1)
  116. 2120    IF LEN(AX$)=4 THEN AH=VAL("&H"+LEFT$(AX$,2)): GOTO 2200
  117. 2130    AH=MAXSERV+1        'Default value (null strings)
  118. 2140    IF LEN(AH$)<>0 THEN X$=AH$ ELSE X$=AX$
  119. 2150    GOTO 2300
  120. 2200    X$=""        'Define X$ if DX or DL is loaded for this call
  121. 2210    IF AH=2 OR (AH>=4  AND AH<= 6) OR AH=9  OR AH=&HA THEN X$=D$: GOTO 2300
  122. 2220    IF (AH>=&HE AND AH<=&H17) OR AH=&H1A OR AH=&H1C THEN X$=D$: GOTO 2300
  123. 2230    IF (AH>=&H21 AND AH<=&H28) THEN X$=D$: GOTO 2300
  124. 2240    IF AH=&H31 OR AH=&H33 OR AH=&H36 OR (AH>=&H38 AND AH<=&H3D) THEN X$=D$
  125. 2250    IF AH=&H41 OR AH=&H43 OR AH=&H47 OR AH=&H4B THEN X$=D$: GOTO 2300
  126. 2260    IF AH=&H4B OR AH=&H56 THEN X$=D$
  127. 2300 '
  128. 2310    PRINT #2, A$
  129. 2320    PRINT #2,: PRINT #2,"DOSCALL "+SERVICE$(AH)+X$+COMMENT$(AH)
  130. 2330    PRINT #2,: PRINT    "DOSCALL "+SERVICE$(AH)+X$+COMMENT$(AH)
  131. 2350    RETURN
  132. 4000 '-----------------------------------------------------------------------
  133. 4001 '|            Table of comments for each Interrupt            |
  134. 4002 '-----------------------------------------------------------------------
  135. 5000    C$=C$+"Divide by Zero":         GOTO 10000    'int 0
  136. 5100    C$=C$+"Single step":            GOTO 10000    'int 1
  137. 5200    C$=C$+"Non-Maskable Interrupt (NMI)":    GOTO 10000    'int 2
  138. 5300    C$=C$+"Break Point Instruction ('CC'x)":GOTO 10000    'int 3
  139. 5400    C$=C$+"Overflow":            GOTO 10000    'int 4
  140. 5500    C$=C$+"Print Screen":            GOTO 10000    'int 5
  141. 5600    C$=C$+"Reserved":            GOTO 10000    'int 6
  142. 5700    C$=C$+"Reserved":            GOTO 10000    'int 7
  143. 5800    C$=C$+"Timer (18.2 per second)":    GOTO 10000    'int 8
  144. 5900    C$=C$+"Keyboard Interrupt":        GOTO 10000    'int 9
  145. 6000    C$=C$+"Reser